package org.example.storage.database;

import org.apache.ibatis.annotations.*;
import org.example.entity.ProductEntity;

@Mapper
public interface ProductEntityMapper {

    @Select("select * from t_product where id = #{id}")
    public ProductEntity selectProductById(Long id);

    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert("insert into t_product(name, produce_timestamp) value(#{name}, #{produceTimestamp})")
    public Integer addProduct(ProductEntity productEntity);

    @Update("update t_product set name = #{name} where id = #{id}")
    public Integer updateProduct(ProductEntity productEntity);

}
